﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using RenAi.Medical.Model;
using RenAi.Medical.BLL;
using System.Data;

namespace RenAi.Medical.Admin
{
    public partial class HB_Update : System.Web.UI.Page
    {
        //实例化对象
        HospitalBasicBLL bll = new HospitalBasicBLL();

        //获取医院基本信息
        public void GetHosp()
        {
            this.txtid.Text = Request.QueryString["HB_Id"].ToString();
            DataTable dt = bll.GetHospitalBasic (this.txtid.Text);
            //保存并显示控件
            this.txtname.Text = dt.Rows[0][1].ToString();
            this.txtTime.Text = dt.Rows[0][2].ToString();
            this.txtPhone.Text = dt.Rows[0][3].ToString();
            this.txtImg.Text = dt.Rows[0][4].ToString();
            this.txtIntro.Text = dt.Rows[0][5].ToString();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                GetHosp();            
            }
        }
        protected void btnback_Click(object sender, EventArgs e)
        {
            Response.Redirect("videoQuery.aspx");
        }

        protected void btnupt_Click1(object sender, EventArgs e)
        {
            HospitalBasic h = new HospitalBasic();
            h.HB_Id = int.Parse(this.txtid.Text);
            h.HB_Name = this.txtname.Text;
            h.HB_Time = this.txtTime.Text;
            h.HB_Phone = this.txtPhone.Text;
            h.HB_URL = this.txtImg.Text;
            h.HB_intro = this.txtIntro.Text;
            //判断
            if (bll.UptHospitalBasic(h) > 0)
            {
                Response.Write("<script>alert('修改成功！');</script>");
                Response.Redirect("videoQuery.aspx");
                GetHosp();
            }
        }
    }
}